﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BestBuy.DAL;
using BestBuy.Common;
using BestBuy.DTO;
namespace BestBuy.PageUser
{
    public partial class ReadMessageItem : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["IDDN"].ToString().Equals(""))
            {
                Response.Redirect("~/Account/Login.aspx");
            }
            if (!IsPostBack)
            {
                loadUnread();
            }
        }
        private int idmess;
        private void loadUnread()
        {
            idmess = int.Parse(Request.Params["IdMessage"].ToString());
            BMessage mess = CMessage.getMessage(idmess);
            ltSender.Text = CMessage.getNameSender(mess.IDTKReceiver);
            ltTitle.Text = CMessage.getTitle(mess.IDTKSender, mess.Source, mess.IDContact);
            ltDate.Text = mess.Date;
            ltContent.Text = mess.Subject;
            unread.Text = CMessage.countMessage(int.Parse(Session["IDDN"].ToString())).ToString();
        }
    }
}